<template>
	<view class="page">
		<CustomNav :isBack="false" color="#fff" :topBgColor="topBgColor" title="宁垦农服"></CustomNav>
		<!-- <view class="search-block" :style="'margin-top:'+mt">
			<input class="search-input" placeholder-class="inputPlaceholder" placeholder="请输入关键字" />
			<view class="search-btn">搜索</view>
		</view> -->
		<swiper class="swiper" :style="'margin-top:'+mt">
			<swiper-item style="width: 100%;height: 100%;" v-for="item in swiper" :key="item.id">
				<image :src="item.img" style="width: 100%;height: 100%;border-radius: 20rpx;"
					@click="navigate(item.url)">
				</image>
			</swiper-item>
		</swiper>
		<view class="list-title">
			<view class="title FZHZGBJ">种业资讯</view>
			<!-- <view class="more">更多</view> -->
		</view>
		<view class="list">
			<view class="list-item" v-for="item in list" :key="item.id"
				@click="navigate('/page_pack/article/article?id='+item.id)">
				<image :src="item.cover" class="cover-image" mode="aspectFill"></image>
				<view class="info">
					<view class="title">{{item.title}}</view>
					<view class="time">{{item.time}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return {
				topBgColor: 'rgba(0,0,0,0)',
				swiper: [{
						id: 1,
						img: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/swiper.png',
						url: '/page_pack/products/products?type=2'
					},
					{
						id: 2,
						img: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/banner2.png',
						url: '/page_pack/products/products?type=1'
					},
				],
				list: [{
						id: 1,
						title: '2024年度玉米种子企业信用等级评价结果',
						time: '2024-04-07',
						cover: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/article-cover.png'
					},
					{
						id: 2,
						title: '甘肃省委省政府发布重要实施意见！',
						time: '2024-04-07',
						cover: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/article-cover.png'
					},
					{
						id: 3,
						title: '温馨提示－种子购买注意事项',
						time: '2024-04-07',
						cover: 'https://suzhou-polite-1306862033.cos.ap-chengdu.myqcloud.com/suzhouzhongzi/article-cover.png'
					},
				],
			}
		},
		watch: {

		},
		methods: {
			//onShareAppMessage 分享给朋友
			onShareAppMessage: function(res) {
				if (res.from === 'button') {

				}
				return {
					title: '酒泉金质种子',
					path: '/pages/index/index'
				}
			},
			onShareTimeline() { // 分享到朋友圈
				return {
					title: '酒泉金质种子',
					path: '/pages/index/index'
				}
			},
		},
		onLoad() {

		}
	}
</script>

<style lang="scss">
	.page {
		overflow: hidden;
		height: 100%;
		background-image: linear-gradient(to bottom, #91D562, #F8F8F8 400px, #F8F8F8 400px, #F8F8F8);
		background-repeat: no-repeat;

		.search-block {
			width: $content-width;
			margin: 0 auto;
			height: 70rpx;
			background: #fff;
			border-radius: 18px;
			padding: 6rpx;
			display: flex;

			.search-btn {
				width: 130rpx;
				height: 100%;
				display: flex;
				align-items: center;
				justify-content: center;
				color: #fff;
				border-radius: 18px;
				font-size: 28rpx;
				background: $theme-color;
			}

			.search-input {
				height: 100%;
				flex-grow: 1;
				margin-left: 20rpx;
				font-size: 28rpx;
			}
		}

		.swiper {
			width: $content-width;
			margin: 20rpx auto;
		}

		.list-title {
			display: flex;
			width: $content-width;
			margin: 0 auto;
			margin-bottom: 20rpx;

			.title {
				color: $theme-color;
				flex-grow: 1;
			}

			.more {
				font-size: 28rpx;
				color: #999;
			}
		}

		.list {
			width: $content-width;
			margin: 0 auto;

			.list-item {
				width: 100%;
				background: #fff;
				border-radius: 10px;
				display: flex;
				align-items: center;
				padding: 20rpx;
				height: 180rpx;
				margin-bottom: 20rpx;

				.cover-image {
					width: 140rpx;
					height: 140rpx;
					border-radius: 8px;
				}

				.info {
					width: calc(100% - 160rpx);
					height: 100%;
					margin-left: 20rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.title {
						width: 100%;
						text-overflow: ellipsis;
						overflow: hidden;
						display: -webkit-box;
						-webkit-line-clamp: 2;
						-webkit-box-orient: vertical;
						white-space: normal;
					}

					.time {
						font-size: 28rpx;
						color: #999;
					}
				}
			}
		}
	}
</style>